package servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.UsersService;

@WebServlet("/userslogin.do")
public class UsersServlet extends HttpServlet {
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		String action=req.getParameter("action");
	
		UsersService service=new UsersService();
		
		String url="";
		if(action.equals("userslogin")){
			url=service.login(req, resp);
			
//			System.out.println(resp);
		}else if(action.equals("userslogout")){
			url=null;
			System.out.println("ffff");
		}
		req.getRequestDispatcher(url).forward(req, resp);
	}
}
